package org.example;

import org.example.dto.NewUserDto;
import org.example.dto.UserDto;
import org.example.mapper.*;
import org.example.po.SubUser;
import org.example.po.User;
import org.mapstruct.factory.Mappers;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author ${USER}
 * @date ${DATE} ${TIME}
 * @apiNote
 */

public class Main {
    public static void main(String[] args) {
        extracted5();


    }

    private static void extracted() {
        User user =new User();
        user.setId(1);
        user.setName("myx");
        user.setAddress("河北沧州");
        user.setBirth(new Date());
        user.setPwd("12313");
        List<User> userList = new ArrayList<>();
        userList.add(user);
        UserMapper mapper = Mappers.getMapper(UserMapper.class);
        UserDto userDto = mapper.userToUserDto(user);
        System.out.println(userDto);
        List<UserDto> userDtoList= mapper.userToUserDto(userList);
        System.out.println(userDtoList);
    }
    private static void extracted2() {
        User user =new User();
        user.setId(1);
        user.setName("myx");
        user.setAddress("河北沧州");
        user.setBirth(new Date());
        user.setPwd("12313");
        List<User> userList = new ArrayList<>();
        userList.add(user);
        User1Mapper mapper = Mappers.getMapper(User1Mapper.class);
        UserDto userDto = mapper.userToUserDto(user);
        System.out.println(userDto);
        List<UserDto> userDtoList= mapper.userToUserDto(userList);
        System.out.println(userDtoList);
    }
    private static void extracted3() {
        User user =new User();
        user.setId(1);
        user.setName("myx");
        user.setAddress("河北沧州");
        user.setBirth(new Date());
        user.setPwd("12313");
        List<User> userList = new ArrayList<>();
        userList.add(user);
        User2Mapper mapper = Mappers.getMapper(User2Mapper.class);
        UserDto userDto = mapper.userToUserDto(user);
        System.out.println(userDto);
        List<UserDto> userDtoList= mapper.userToUserDto(userList);
        System.out.println(userDtoList);
    }
    private static void extracted4() {
        User user =new User();
        user.setId(1);
        user.setName("myx");
        user.setAddress("河北沧州");
        user.setBirth(new Date());
        user.setPwd("12313");
        SubUser subUser = new SubUser();
        subUser.setDeleted(0);
        subUser.setName("rkw");
        user.setSubUser(subUser);
        List<User> userList = new ArrayList<>();
        userList.add(user);
        User3Mapper mapper = Mappers.getMapper(User3Mapper.class);
        UserDto userDto = mapper.userToUserDto(user);
        System.out.println(userDto);
        List<UserDto> userDtoList= mapper.userToUserDto(userList);
        System.out.println(userDtoList);
    }
    private static void extracted5() {
        User user =new User();
        user.setId(1);
        user.setName("myx");
        user.setAddress("河北沧州");
        user.setBirth(new Date());
        user.setPwd("12313");
        SubUser subUser = new SubUser();
        subUser.setDeleted(0);
        subUser.setName("rkw");
        User4Mapper mapper = Mappers.getMapper(User4Mapper.class);
        NewUserDto userDto = mapper.userToUserDto(user,subUser);
        System.out.println(userDto);


    }
}